//
//  CBWIndexViewController.swift
//  weibo
//
//  Created by 陈博文 on 16/5/25.
//  Copyright © 2016年 陈博文. All rights reserved.
//

import UIKit
let indexCellIdentifer = "indexCellIdentifer"


class CBWIndexViewController: UIViewController ,UITableViewDelegate,UITableViewDataSource{
// MARK:=============== lifeCircle ===============
    override func viewDidLoad() {
        super.viewDidLoad()

        self.navigationItem.title = "首页"
       
        self.setUpTableView()
    }

    func setUpTableView(){
        
        self.automaticallyAdjustsScrollViewInsets = false
     
        
        let tableView = UITableView(frame: UIScreen.mainScreen().bounds)
        tableView.delegate = self
        tableView.dataSource = self
        tableView.rowHeight = 300
        tableView.contentInset = UIEdgeInsets(top: navigationBarH, left: 0, bottom: tabBarH, right: 0)
        tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: indexCellIdentifer)
        self.view.addSubview(tableView)
    }
    // MARK:=============== datasource ===============
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10;
    }
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        
        let cell = tableView.dequeueReusableCellWithIdentifier(indexCellIdentifer)
       cell?.textLabel?.text = "第\(indexPath.row)"
    print("%p",cell)
        return cell!
        
        
    }

}
